import unittest
import StringIO
from ffmpeg.metadata import Metadata
from ffmpeg.metadata import parse_ffmpeg_metadata


output1 = '''FFmpeg version SVN-r6213, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  --enable-pthreads --disable-network --disable-audio-oss --disable-v4l --disable-bktr --disable-dv1394 --disable-ffserver --disable-ffplay --enable-faac --enable-faad --enable-a52 --enable-x264 --enable-mp3lame --enable-gpl --disable-debug --enable-amr_wb --enable-amr_nb 
  libavutil version: 49.0.0
  libavcodec version: 51.14.0
  libavformat version: 50.5.0
  built on Sep 23 2006 13:58:32, gcc: 4.0.1 (Apple Computer, Inc. build 5363)

Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 0.17 (1/6)
Input #0, flv, from 'foo.flv':
  Duration: 00:00:06.0, start: 0.000000, bitrate: N/A
  Stream #0.0: Audio: mp3, 44100 Hz, stereo
  Stream #0.1: Video: vp6f, yuv420p, 368x288,  0.17 fps(r)
Must supply at least one output file
'''

# output1 = 'Duration: 00:00:06.0, start: 0.000000, bitrate: N/A'

class MetadataTest(unittest.TestCase):
	
	def setUp(self):
		pass
		
	def tearDown(self):
		pass
		
	def test_parse_ffmpeg_metadata(self):
		metadata = parse_ffmpeg_metadata(StringIO.StringIO(output1))
		assert(metadata.duration, '00:00:06.0')
		assert(metadata.bitrate, 'N/A')
		


